﻿<local:DocumentBase x:Class="WPFExcelReport.WGGINV"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:ReflectionStudio.Core.Database;assembly=ReflectionStudio.Core"
                    xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
                    xmlns:wep="clr-namespace:WPFExcelReport"
                      
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
                    Loaded="Window_Loaded"
                    Title="后整状态"  
                    HorizontalAlignment="Stretch"  Margin="0,0,0,0"  VerticalAlignment="Stretch"
     >
    <local:DocumentBase.Resources>
        <db:INTEXDataSet x:Key="iNTEXDataSet" />
        <CollectionViewSource x:Key="wASTAMMViewSource" Source="{Binding Path=WASTAMM, Source={StaticResource iNTEXDataSet}}" />
        <CollectionViewSource x:Key="mAINViewSource" Source="{Binding Path=WBBEW, Source={StaticResource iNTEXDataSet}}" />
    </local:DocumentBase.Resources>
    <Grid DataContext=""  HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <WrapPanel Grid.Row="0" Name="zoneCommand" Height="34" Margin="0,0,0,6">
            <Button  Content="查询"  Height="23" Margin="10,0,0,0"  Name="btnQuery" Width="75" Click="btnQuery_Click" />
            <Button Content="仅生成报表" Margin="10,0,0,0"   Height="23"   Name="btnReport" Width="75" Click="btnReport_Click" />
            <Button Content="打印报表" Margin="10,0,0,0"  Height="23" Name="btnPrint" Width="90" Click="btnPrint_Click"/>
            <Button Content="浏览数据"  Margin="10,0,0,0"  Height="23"  Name="btnPrintPreview" Width="90" Click="btnPrintPreview_Click"/>
            <Button Content="重新生成期初数据"  Margin="10,0,0,0"  Height="23"  Name="btnRegenerateLastInv" Width="90" Click="btnRegenerateLastInv_Click"/>
            <Button Content="保存作为期初数据"  Margin="10,0,0,0"  Height="23"  Name="btnSaveAsInv" Width="90" Click="btnSaveAsInv_Click"/>
        </WrapPanel>
        <StackPanel Grid.Row="1" Name="MainPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <WrapPanel>
                <Label Content="年"    Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF242222" />
                <TextBox Name="txtYEAR" Width="90" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" FontSize="18" Text="2011" KeyDown="txt_KeyDown" CharacterCasing="Upper" AcceptsTab="False" MaxLength="2" Foreground="#FF242222" />
                <Label Content="月"    Width="30" Margin="10,0,0,0" HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF242222" />
                <TextBox Name="txtMONTH" Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Beige" Text="05" FontSize="18" Height="30" KeyDown="txt_KeyDown" AcceptsTab="False" CharacterCasing="Upper" MaxLength="6" Panel.ZIndex="1" Foreground="#FF242222" />
                <Label Content="记账日"    Width="60" Margin="10,0,0,0" HorizontalAlignment="Left"    FontSize="18" VerticalAlignment="Center" Foreground="#FF242222" />
                <TextBox Name="txtDAY" Width="60" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="YellowGreen" FontSize="18" Text="01" Height="30" KeyDown="txt_KeyDown" AcceptsTab="False" MaxLength="3" Panel.ZIndex="2" Foreground="#FF242222" />
                </WrapPanel>
            <Expander Header="数据" Name="zoneDataList"  IsExpanded="True"
                      HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
                <fd:FilteringDataGrid AutoGenerateColumns="False" EnableRowVirtualization="True"  
                                              ItemsSource="{Binding}" 
                                              x:Name="MasterDg" 
                                                 CanUserReorderColumns="True"  
                                             CanUserResizeRows="True"
                                              CanUserSortColumns="True"
                                              IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="1000"
                                              Height="400"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="ItemsControls_SelectionChanged"
                                              >
                    <DataGrid.Columns>
                        <!--ARTICLE,WBEWBESCHICH,WBEWBUCHDAT,WBEWBS,WBBDPART,  PCNUM,WBEWLO,WBEWLB,  WBEWMTR STARTQTY, ENDQTY, 
                        STARTPCNUM,0 as ENDPCNUM-->
                        <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="品种" Width="SizeToHeader"  MinWidth="80"/>
                        <DataGridTextColumn Binding="{Binding Path=WBEWBUCHDAT}" Header="日期" Width="SizeToCells" MinWidth="40" />
                        <DataGridTextColumn Binding="{Binding Path=WBEWBS}" Header="方式" Width="SizeToHeader" MinWidth="40"/>
                        <DataGridTextColumn Binding="{Binding Path=FUNCTION}" Header="类型" Width="SizeToHeader" MinWidth="80"/>                        
                        <DataGridTextColumn Binding="{Binding Path=WBBDPART}" Header="缸号" Width="SizeToHeader" MinWidth="60"/>                        
                        <DataGridTextColumn Binding="{Binding Path=WBEWLO}" Header="仓库" Width="SizeToHeader"  MinWidth="20"/>
                         <DataGridTextColumn Binding="{Binding Path=STARTQTY}" Header="期初数量"  FontSize="12" Width="SizeToHeader" MinWidth="60"/>
                        <DataGridTextColumn Binding="{Binding Path=STARTPCNUM}" Header="期初匹数"   FontSize="12"  Width="SizeToHeader" MinWidth="40"/>
                        <DataGridTextColumn Binding="{Binding Path=WBEWMTR}" Header="数量"   FontSize="12" Foreground ="Red" Width="SizeToHeader"  MinWidth="60"/>
                        <DataGridTextColumn Binding="{Binding Path=PCNUM}" Header="匹数"  FontSize="12" Foreground="Red" Width="SizeToHeader" MinWidth="20"/>
                        <DataGridTextColumn Binding="{Binding Path=ENDPCNUM}" Header="期末匹数"  FontSize="12"  Width="SizeToHeader" MinWidth="20"/>
                        <DataGridTextColumn Binding="{Binding Path=ENDQTY}" Header="期末数量" FontSize="12" Width="SizeToHeader" MinWidth="40"/> 
                    </DataGrid.Columns>
                </fd:FilteringDataGrid>
            </Expander>
        </StackPanel>
        <fd:FilteringDataGrid
          Grid.Row="2"
          AutoGenerateColumns="False" EnableRowVirtualization="True"  
                                              ItemsSource="{Binding}" 
                                              x:Name="SndDg" 
                                                 CanUserReorderColumns="True"  
                                             CanUserResizeRows="True"
                                              CanUserSortColumns="True"
                                              IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="1000"
                                              Height="300"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="ItemsControls_SelectionChanged"
                                              >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=INVDATE}" Header="盘存日期" Width="SizeToHeader"  MinWidth="120"/>
                <DataGridTextColumn Binding="{Binding Path=WBBLO}" Header="仓库" Width="SizeToCells" />
                <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="品种" Width="SizeToHeader" MinWidth="80"/>
                <DataGridTextColumn Binding="{Binding Path=WBBDPART}" Header="缸号" Width="SizeToCells" />
                <DataGridTextColumn Binding="{Binding Path=INVPCNUM}" Header="匹数" Width="SizeToCells" />                
                <DataGridTextColumn Binding="{Binding Path=INVQTYMTR}" Header="数量" Width="SizeToCells" />                
            </DataGrid.Columns>
        </fd:FilteringDataGrid>
    </Grid>
</local:DocumentBase>
